//-------------------- 右键菜单演示 ------------------------//
var copy_interface_data = "";

chrome.contextMenus.create({
  title: "复制ts接口",
  documentUrlPatterns: [
    "http://10.118.71.84:10086/*",
    "https://zhishiku.casstime.com/*",
  ],
  onclick: function (info, tab) {
    navigator.clipboard.writeText("copy_interface_data").then(
      function (data) {
        // console.log("sucess", data);
      },
      function (e) {
        var el = document.createElement("textarea");
        el.value = copy_interface_data;
        document.body.appendChild(el);
        el.select();
        document.execCommand("copy");
        document.body.removeChild(el);
      }
    );
  },
});

chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
  copy_interface_data = request.data;
});
